package dao;


import java.util.*;

import org.hibernate.*;

import entities.MaterialBean;



public class MaterialDAO {
	
	public List<dto.Material> materialesSinOC()
	{
		List<dto.Material> x = new ArrayList<dto.Material>();
		
		SessionFactory sf = hbt.HibernateUtil.getSessionFactory();
		Session s = sf.openSession();
		
		//Material o MaterialBean??? MMmmm...
		@SuppressWarnings("unchecked")	
		List<entities.MaterialBean> matSinOc = 
				s.createQuery("from MaterialBean m "
							+ "where m.codigo not in (select i.material.codigo"
							+ "							from ItemOCBean i)	)").list();
		
		for(MaterialBean m : matSinOc)
			x.add(m.toDTO());
		return x;
	}
	
}
